<!DOCTYPE html>
<html lang="en" style="height:100%">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>完善信息</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/yzl.css"/>
    <style>
    .input-center{
      margin: 0 auto;
      height：60px;
      width:100%;
      line-height: 60px
    }
    input{
      height:100%;
      width:100%;
      height:60px;
      /*line-height: 60px;*/
      outline: none
    }
    .regrist-button{
      margin-top: 50px;
      background: #ccc;
      cursor: pointer;
      border: none;
      font-size: 18px;
      display: block;
      width: 100%;
      margin-bottom: 10px;
      color:#fff;
      padding: 15px 0;
      border-radius:4px;
      text-align: center;
      vertical-align: top;
      white-space: nowrap;
      font-weight: 400;
      line-height: 20px;
      position: relative;
      outline:none;
    }
    .register-btn{
      background: #9D0152
    }
    .input-center input{
      border:none;
      border-bottom: 1px solid #ccc;
    }
    </style>
</head>
<body style="height:100%;">
  <div id="blank" class="header">
      <div v-back.tapmode class="back"></div>
      <span class="title">完善信息</span>
  </div>
  <div  id="app" v-cloak style="margin:0 auto;padding-top:70px;width:80%">
  <div class="input-center">
    <input class="input" type="number" v-model="phone" ref="input1" placeholder="请输入手机号码"  required />
  </div>
  <div class="input-center" style="position:relative">
    <input type="number" class="getcodecontent" v-model="verify_code" ref="input2"  placeholder="请输入验证码" />
    <sendcode  :phone="phone" type="8"  style="position:absolute;right:0px;top:40px"></sendcode>
  </div>
  <div class="input-center">
      <input class="input" type="password" ref="text" placeholder="请输入邀请码(必填)" v-model="invite_code"  required />
      <div><span style="color:rgba(153,153,153,1);font-size:12px">关注友人店公众号</span><span style="color:#9d0152;font-size:12px">可获取邀请码</span></div>
  </div>

    <button v-myclick="login" type="button" class="regrist-button" :class="{'register-btn':phone&&verify_code&&invite_code}" >登录</button>
  </div>
<script src="../../script/api.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/url.js"></script>
<script src="../../script/components.js"></script>
<script>

    var pageParam,
        vm;
    var talkingData;
    apiready = function () {
        setBSImg();
        new Vue({
            el: '#blank',
        });
        talkingData = api.require('talkingData');
        pageParam = api.pageParam;
        initApp();
        api.parseTapmode();
        addListeners();
    };

    function initApp() {
        var isBigImg = Vue.BSImg == 'big';
        vm = new Vue({
            el: '#app',
            data: {
                isTip: false,
                pageParam: pageParam,
                phone: null,
                verify_code: null,
                invite_code: null,
                isTip: false,
                inputType: "password",
                isClose: true,
                isLogin: false,
                BSImg: {
                    big: isBigImg,
                    small: !isBigImg
                }
            },
            methods: {
                changeStyle: function (value) {
                    this.isClose = !value;
                },
                tipShow: function (value) {
                    this.isTip = !value;
                },
                login: function () {
                    showProgress();
                    var data = {
                        oauth: this.pageParam.oauth,
                        openid: this.pageParam.openid,
                        unionid: this.pageParam.unionid ? this.pageParam.unionid : '',
                        nickname: this.pageParam.nickname,
                        sex: this.pageParam.sex,
                        portrait: this.pageParam.portrait,
                        phone: this.phone,
                        verify_code: this.verify_code,
                        invite_code: this.invite_code,
                        jpush_token:getPrefs('jpush_token') || ''
                    };
                    if (hasPrefs('member_id')) {
                        data.member_id = getPrefs('member_id');
                    }
                    var callback = function (ret) {
                        vm.login_init(ret.content);
                    };
                    pinet.post(URL.oauthRegister, data, callback);
                },
                login_init: function (user) {
                    setPrefs('user', user);
                    setPrefs('token', user.token);
                    setPrefs('member_id', user.member_id);
                    api.sendEvent({
                        name: 'reLogin'
                    });
                  if (user.member_type == '3'||user.member_type == '4') {
                      openWin('../user/user2');
                  } else {
                      openWin('../../index', {to:4,fromChangeUser:true});
                  }
                },
                receiveInvite_code: function (val) {
                    this.invite_code = val;
                }
            }
        })
    }

    function addListeners() {
        api.addEventListener({
            name:'viewdisappear'
        }, function(ret, err){
            closeWin('setInfo');
        });
    }
</script>
</body>
</html>
